package cn.wolfcode.mycat.controller;

import cn.wolfcode.mycat.handler.TestService;
import cn.wolfcode.mycat.service.IExecCommandServer;
import com.google.common.collect.Maps;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@CrossOrigin
@RestController
@Api(value = "ExecCommandController服务", tags = "ExecCommandController服务")
public class ExecCommandController {
 
    @Autowired
    private IExecCommandServer execCommandServer;
    @Autowired
    private TestService testService;
    
    @GetMapping("/linux/exec")
    @ApiOperation(value = "执行命令")
    public String execCommand(String cmd) throws Exception {
        execCommandServer.execCommand(cmd);
        return "ok";
    }
	
	@GetMapping("/test/execute")
	@ApiOperation(value = "执行命令")
	public String testExcecute() throws Exception {
		testService.test(Maps.newHashMap());
		return "ok";
	}
 
 
 
}
